package com.haoyang.sort;

public class A04_RecursionDemo1 {

    public static void main(String[] args) {

        int sum = getSum(100);
        System.out.println(sum);
    }

    /**
     * 定义一个递归方法用于求一个范围类整数的和
     */
    public static int getSum(int number) {
        if (number == 1) {
            return 1;
        }
        return number + getSum(number - 1);
    }
}
